home *** CD-ROM | disk | FTP | other *** search
Wrap
Attribute VB_Name = "Module1" '* ********************************************************************** *' '* *** MEDIADYN.BAS *** *' '* *** *** *' '* *** Media Control Library *** *' '* *** A Product of MediaDynamics Inc. (c) 1993-1995 *** *' '* *** ___ ___ *** *' '* *** | \ / | *** *' '* *** | \ / | *** *' '* *** | \ / | *** *' '* *** | \ __ /___ | *** *' '* *** | |\ \ | | |\ *** *' '* *** | | \ \| -----| | \ *** *' '* *** | | \ \/ / | | \ *** *' '* *** | | \ / | |\ \ *** *' '* *** | | \ / | | | | *** *' '* *** | | \ /| | | | | *** *' '* *** |__| \/ | |__| | | *** *' '* *** | | | | *** *' '* *** | | / / *** *' '* *** | |-------/ / *** *' '* *** |____________/ *** *' '* *** *** *' '* *** *** *' '* *** Declaration file for using the Media Control Library within *** *' '* *** Microsoft Visual Basic. *** *' '* *** *** *' '* ********************************************************************** *' ' ******************************************************************** ' ' *** *** ' ' *** Global Constants *** ' ' *** *** ' ' ******************************************************************** ' ' ******************************************************************** ' ' *** For use with the Command: mdPlay *** ' ' ******************************************************************** ' Global Const MD_PLAY_NONMODAL = 0 ' Normal mode - Play concurrently Global Const MD_PLAY_MODAL = 1 ' Modal - Play til done ' ******************************************************************** ' ' *** For use with the Commands: mdSetCursor, *** ' ' *** mdSetVideoCursor, *** ' ' *** mdSetCtrlCursor *** ' ' ******************************************************************** ' Global Const MD_CURSOR_BLANK = 0 ' Invisible cursor Global Const MD_CURSOR_HAND1 = 1 ' Type 1 hand cursor Global Const MD_CURSOR_HAND2 = 2 ' Type 2 hand cursor Global Const MD_CURSOR_HOURGLASS = 3 ' Wait hourglass Global Const MD_CURSOR_MAGNIFY = 4 ' Magnifying glass Global Const MD_CURSOR_QUESTPOINT = 5 ' Pointer cursor with question mark Global Const MD_CURSOR_CROSSHAIR1 = 6 ' Type 1 crosshair cursor Global Const MD_CURSOR_CROSSHAIR2 = 7 ' Type 2 crosshair cursor Global Const MD_CURSOR_CROSS = 8 ' Large cross cursor Global Const MD_CURSOR_MOVE = 9 ' left/right/up/down arrow cursor ' ******************************************************************** ' ' *** For use with the Command: mdSetAudioLevel *** ' ' ******************************************************************** ' Global Const MD_AUDIO_MIN = 0 ' Lowest audio level Global Const MD_AUDIO_MAX = 100 ' Maximum audio level ' ******************************************************************** ' ' *** For use with the Command: mdSetPlaybackSpeed *** ' ' ******************************************************************** ' Global Const MD_PLAYBACK_MIN = 0 ' Slowest playback speed Global Const MD_PLAYBACK_NORM = 100 ' Normal playback speed Global Const MD_PLAYBACK_MAX = 200 ' Double playback speed ' ******************************************************************** ' ' *** For use with the Command: mdGetPlayState *** ' ' ******************************************************************** ' Global Const MD_PLAYSTATE_CLOSED = 0 ' No file is open Global Const MD_PLAYSTATE_PLAYING = 1 ' File is currently playing Global Const MD_PLAYSTATE_SEEKING = 2 ' File is currently seeking to a frame Global Const MD_PLAYSTATE_PAUSED = 3 ' File is currently paused Global Const MD_PLAYSTATE_END = 4 ' File has played to the end (Of the file or specified clip) Global Const MD_PLAYSTATE_STOPPED = 5 ' File is currently stopped ' ******************************************************************** ' ' *** For use with the Command: mdGetFileType *** ' ' ******************************************************************** ' Global Const MD_MEDIATYPE_AVI = 0 ' VfW, Indeo, Cinepak, etc. Global Const MD_MEDIATYPE_AVS = 1 ' Intel DVI (RTV or PLV) Global Const MD_MEDIATYPE_WAV = 2 ' Wave Audio (Compressed or Uncompressed Global Const MD_MEDIATYPE_MPEG = 3 ' MPEG Video Global Const MD_MEDIATYPE_QTW = 4 ' Quicktime for Windows ' ******************************************************************** ' ' *** For use with the Commands: mdOpen and mdSetWinSize *** ' ' ******************************************************************** ' Global Const MD_VIDSIZE_W_AUTOMATIC = 10 ' Width Parameter: Automatically size the video Global Const MD_VIDSIZE_H_AUTOMATIC = 0 ' Height Parameter: Required to make the sizing automatic ' ******************************************************************** ' ' *** For use with the Commands: mdOpen and mdSetClip *** ' ' ******************************************************************** ' Global Const MD_FRAME_DEFAULT_BEG = 0 ' Automatically start the clip at the 1st frame Global Const MD_FRAME_DEFAULT_END = 0 ' Automatically end the clip on the last frame ' ******************************************************************** ' ' *** For use with the Command: mdOpen *** ' ' ******************************************************************** ' Global Const MD_LOAD_AV_SHOW = 0 ' Preload Parameter: Load and immediately show Global Const MD_LOAD_AV_HIDDEN = 1 ' Preload Parameter: Load and keep hidden until mdShow ' ******************************************************************** ' ' *** For use with the Commands: mdOpen and mdSetCtrlType *** ' ' ******************************************************************** ' Global Const MD_CONTROL_INT_MODAL = 1 ' Shows the control bar with a close button (modal) Global Const MD_CONTROL_INT_NONMODAL = 2 ' Shows the control bar without a close button (non-modal) Global Const MD_CONTROL_INT_NONE = 3 ' Does not show the control bar (best with user defined controls) ' ******************************************************************** ' ' *** *** ' ' *** Control Functions and Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Public Declare Function mdOpen Lib "mdCtrl32.dll" (ByVal hwndParent As Integer, ByVal szFileName As String, ByVal nXPos As Integer, ByVal nYPos As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal lBeg As Long, ByVal lEnd As Long, ByVal nType As Integer, ByVal bPreload As Integer) As Integer ' Use the following line as a template ' ngFileHandle = mdOpen(Form.hWnd, "video.avi", nXPos, nYPos, VIDSIZE_W_AUTOMATIC, VIDSIZE_H_AUTOMATIC, FRAME_DEFAULT_BEG, FRAME_DEFAULT_END, CONTROL_INT_NONMODAL, LOAD_AV_SHOW) Public Declare Function mdOpenLite Lib "mdCtrl.dll" (ByVal hwndParent As Integer, ByVal szFileName As String, ByVal nXPos As Integer, ByVal nYPos As Integer, ByVal bCtrl As Integer) As Integer Declare Function mdClose Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Sub mdPlay Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal bModal As Integer) Declare Sub mdPause Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdStep Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdStop Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdGotoFrame Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal dwGotoFrame As Long) Declare Sub mdRewind Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdRestart Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) ' ******************************************************************** ' ' *** *** ' ' *** Window Control Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Declare Sub mdHide Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdShow Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdHideVideo Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdShowVideo Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdHideCtrl Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdShowCtrl Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) ' ******************************************************************** ' ' *** *** ' ' *** Parameter Setting Functions and Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Declare Sub mdSetClip Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal dwBeg As Long, ByVal dwEnd As Long) Declare Sub mdSetWinPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal xPos As Integer, ByVal yPos As Integer) Declare Sub mdSetWinSize Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) Declare Sub mdSetVideoWinPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal xPos As Integer, ByVal yPos As Integer) Declare Sub mdSetVideoWinSize Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer) Declare Sub mdSetCtrlWinPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal xPos As Integer, ByVal yPos As Integer) Declare Sub mdSetCtrlWinSize Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nWidth As Integer) Declare Sub mdSetWindowMoveable Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal bMoveable As Integer) Declare Sub mdSetWindowInteractive Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal binteract As Integer) Declare Sub mdSetAudioLevel Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nAudioLevel As Integer) Declare Sub mdSetAudioMute Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdSetCtrlType Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nType As Integer) Declare Sub mdSetWinTop Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdSetWinBottom Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdSetNewParent Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal hNewParent As Integer) Declare Sub mdSetClippingRegion Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nXPos As Integer, ByVal nYPos As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal nDisplayFlag As Integer) Declare Sub mdSetVideoAspect Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nXPos As Integer, ByVal nYPos As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal nJustify As Integer, ByVal bLimitFlag As Integer) Declare Sub mdSetVideoOffset Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nDown As Integer, ByVal nRight As Integer) Declare Sub mdSetVideoPalette Lib "mdCtrl.dll" (ByVal bPalFlag As Integer) Declare Sub mdSetKeyColor Lib "mdCtrl.dll" (ByVal nRed As Integer, ByVal nGreen As Integer, ByVal nBlue As Integer) Declare Sub mdSetPlaybackSpeed Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nPlaybackSpeed As Integer) ' ******************************************************************** ' ' *** *** ' ' *** Informational Functions and Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Declare Function mdGetFileType Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetWindowHandle Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetDeviceID Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetFrame Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Long Declare Function mdGetClipFrame Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Long Declare Function mdGetLength Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Long Declare Function mdGetClipLength Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Long Declare Function mdGetPlayState Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetDisplayState Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Sub mdGetWinPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, nXPos As Integer, nYPos As Integer) Declare Sub mdGetWinSize Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, nWidth As Integer, nHeight As Integer) Declare Function mdGetWinX Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetWinY Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetWinWidth Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetWinHeight Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Sub mdGetVideoWinPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, xPos As Integer, yPos As Integer) Declare Sub mdGetVideoWinSize Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, nWidth As Integer, nHeight As Integer) Declare Function mdGetVideoWinX Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetVideoWinY Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetVideoWinWidth Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetVideoWinHeight Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Sub mdGetCtrlWinPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, xPos As Integer, yPos As Integer) Declare Sub mdGetCtrlWinSize Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, nWidth As Integer) Declare Function mdGetCtrlWinX Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetCtrlWinY Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetCtrlWinWidth Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetAreaClicked Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetOpenFileCount Lib "mdCtrl.dll" () As Integer Declare Function mdGetFrameRate Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer Declare Function mdGetPlayedStatus Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) As Integer ' ******************************************************************** ' ' *** *** ' ' *** Graphics Functions and Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Declare Function mdOpenGraphic Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal FileNameIn As String) As Integer Declare Function mdOpenGraphicKeep Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal FileNameIn As String) As Integer Declare Function mdShowGraphic Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal bShowPalette As Integer) As Integer Declare Function mdShowGraphicPos Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal nXPos As Integer, ByVal nYPos As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal bShowPalette As Integer) As Integer Declare Sub mdHideGraphic Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Sub mdCloseGraphic Lib "mdCtrl.dll" (ByVal nFileHandle As Integer) Declare Function mdDisplayGraphic Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal FileNameIn As String, ByVal nXPos As Integer, ByVal nYPos As Integer, ByVal bShowPalette As Integer) As Integer ' ******************************************************************** ' ' *** *** ' ' *** Cursor Control Functions and Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Declare Sub mdSetCursor Lib "mdCtrl.dll" (ByVal nCursorNo As Integer) Declare Sub mdResetCursor Lib "mdCtrl.dll" () Declare Sub mdSetVideoCursor Lib "mdCtrl.dll" (ByVal nCursorNo As Integer) Declare Sub mdResetVideoCursor Lib "mdCtrl.dll" () Declare Sub mdSetCtrlCursor Lib "mdCtrl.dll" (ByVal nCursorNo As Integer) Declare Sub mdResetCtrlCursor Lib "mdCtrl.dll" () ' ******************************************************************** ' ' *** *** ' ' *** Miscellaneous Functions and Subroutines *** ' ' *** *** ' ' ******************************************************************** ' Declare Sub mdTimedDelay Lib "mdCtrl.dll" (ByVal seconds As Single) Declare Function mdFileDoesNotExist Lib "mdCtrl.dll" (ByVal FileToCheck As String) As Integer Declare Function mdFileDoesExist Lib "mdCtrl.dll" (ByVal FileToCheck As String) As Integer Declare Sub mdDisplayErrorMsgs Lib "mdCtrl.dll" (ByVal bErrMsgFlag As Integer) Declare Sub mdCDEject Lib "mdCtrl.dll" (ByVal bEject As Integer) Declare Sub mdAbout Lib "mdCtrl.dll" () Declare Function mdMCISendString Lib "mdCtrl.dll" (ByVal nFileHandle As Integer, ByVal szMCIString As String) As Long ' ***************************************************************** ' ' *** sbrGetColor *** ' ' *** *** ' ' *** Description: This routine accepts an RGB color in a *** ' ' *** long integer and extracts out the Red, Green and Blue *** ' ' *** components. *** ' ' *** *** ' ' *** The nRed, nGreen and nBlue variables are passed by *** ' ' *** reference so all three can be modified at one time *** ' ' *** *** ' ' *** Type: Subroutine *** ' ' *** *** ' ' *** Parameters: *** ' ' *** lColor : Long : Color Value *** ' ' *** nRed : Integer : Red Component (value returned) *** ' ' *** nGreen : Integer : Green Component (value returned) *** ' ' *** nBlue : Integer : Blue Component (value returned) *** ' ' *** *** ' ' ***************************************************************** ' ' Sub sbrGetColor(ByVal lColor&, nRed%, nGreen%, nBlue%) nRed = lColor And 255 ' Low order byte nGreen = CInt((lColor And 65280) / 256) ' Middle byte nBlue = CInt((lColor And 16711680) / 65536) ' Third byte End Sub ' ***************************************************************** ' ' *** szfuncFormatTime *** ' ' *** *** ' ' *** Description: This function formats and returns a *** ' ' *** string with the time calculated from the passed frame *** ' ' *** number and the frame rate in frames per second. *** ' ' *** Format: "00:00:00.00" *** ' ' *** *** ' ' *** Type: String *** ' ' *** *** ' ' *** Parameters: *** ' ' *** lFrameNo : Long : Current frame number *** ' ' *** nFrameRate : Integer : Frame rate of the file *** ' ' *** *** ' ' ***************************************************************** ' ' Function szfuncFormatTime$(ByVal lFrameNo As Long, ByVal nFrameRate As Integer) Dim lFrames&, lSeconds&, lMinutes&, lHours& ' These calulations are based on the ' playback rate of the video or audio If nFrameRate Then lFrames = lFrameNo Mod nFrameRate ' Number of extra frames lSeconds = Int(lFrameNo / nFrameRate) ' Total Full Seconds lHours = Int(lSeconds / 3600) ' Hours lMinutes = Int((lSeconds - (lHours * 3600)) / 60) ' Minutes lSeconds = lSeconds Mod 60 ' Seconds End If ' Format the string into "00:00:00.00" format szfuncFormatTime = Format$(lHours, "00") & ":" & Format$(lMinutes, "00") & ":" & Format$(lSeconds, "00") & "." & Format$(lFrames, "00") End Function